package com.lyz.controller;

import com.lyz.entity.User;
import com.lyz.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.w3c.dom.stylesheets.LinkStyle;

import java.util.List;

@RestController
//@CrossOrigin("*")
public class UserController {

    @Autowired
    private UserService userService;

    @PostMapping("/user")
    public String showUser(@RequestBody User user){
        System.out.println("user = " + user);
        return "succ";
    }

    @PostMapping("/userList")
    public List<User> users(){
        List<User> all = userService.findAll();
        return all;
    }
}